import { createRouter, createWebHistory } from 'vue-router';

// * history对象
const routerHistory = createWebHistory()


// 1. 定义路由组件

// todo 1.1 公共布局

// * 1.1.1 BaiscLayout 
import BasicLayout from '@/layouts/BasicLayout.vue';
// * 1.1.2 LoginLayout 
import LoginLayout from '@/layouts/BasicLayout.vue';

// * 1.2.1 Home
import Home from '@/pages/Home/index.vue';
// * 1.2.2 Normal
import NormalTest from '@/pages/NormalTest/index.vue';


// 
import Login from '@/pages/Login/index.vue';




// 2. 定义路由
const routes = [
  {
    path: '/login',
    component: LoginLayout,
    children: [{
      path: '',
      component: Login
    }]
  },

  {
    path: '/',
    component: BasicLayout,
    children: [{
      path: 'home',
      component: Home
    },
    {
      path: 'test',
      component: NormalTest,
      children: [{
        path: ':name',
        component: NormalTest,
      },]
    },


    ]
  }]

// 3. 创建router对象
const router = createRouter(
  {
    history: routerHistory,
    routes
  }
)

// 4. 导出对象
export default router;